﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DTO;
using AutoMapper;

namespace Data 
{
    public class TacGiaRepository 
    {
        public List<TacGiaDTO> SelectAllTacGias()
        {
            List<TacGiaDTO > list = new List<TacGiaDTO >();
            QuanLyNhaSachEntities context = new QuanLyNhaSachEntities();

            var query = from tgItem in context.TacGiaList 
                        select tgItem;
            foreach (TACGIA  item in query)
            {
                TacGiaDTO dto = new TacGiaDTO();
                Mapper.CreateMap<TACGIA, TacGiaDTO>();
                dto = Mapper.Map<TACGIA, TacGiaDTO>(item);

                list.Add(dto);
            }
            return list;
        }
    }
}
